package com.zhyl.demo.service.impl;

import com.zhyl.demo.entity.Specialty;
import com.zhyl.demo.mapper.SpecialtyMapper;
import com.zhyl.demo.service.SpecialtyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class SpecialtyServiceImpl implements SpecialtyService {


    private final SpecialtyMapper specialtyMapper;

    @Autowired
    public SpecialtyServiceImpl(SpecialtyMapper specialtyMapper){
        this.specialtyMapper = specialtyMapper;
    }

    @Override
    public ArrayList<Specialty> selectList(){
        ArrayList<Specialty> list = specialtyMapper.selectList();
        if (list!=null){
            return list;
        }else {
            return null;
        }

    }

    @Override
    public Boolean addNewSpecialty(Specialty specialty) {
        Integer i = specialtyMapper.addNewSpecialty(specialty);
        return i>=0;
    }

    @Override
    public Boolean deleteSpecialty(Integer id) {
        Integer i = specialtyMapper.deleteSpecialty(id);
        return i>=0;
    }

    @Override
    public Boolean updateSpecialty(Specialty specialty) {
        Integer i = specialtyMapper.updateSpecialty(specialty);
        return i>=0;
    }

}
